1. Technical Field
The present invention relates to an image processing apparatus capable of generating composite image data, in which a dynamic range is extended, by using a plurality of image data obtained by photographing a measuring object more than once based on different exposure conditions.
2. Related Art
In an FA (Factory Automation) field, a so-called visual sensor is put into practical use, as an apparatus for optically inspecting a defect and the like generated in a measuring object such as a workpiece, and optically measuring a size of this defect.
When inspection and measurement are performed by using such a visual sensor, the measuring object must be properly photographed. Generally, a dynamic range (a gradation range capable of expressing luminance) of an image pickup apparatus that acquires images by an image pickup element such as a CCD (Coupled Charged Device) and a CMOS (Complementary Metal Oxide Semiconductor) sensor is limited. Therefore, when an exposure amount at the time of photographing is increased, total or partial overexposure (halation) occurs in a photographed image, and luminance information and color information of the measuring object cannot be accurately acquired. Reversely, when the exposure amount is decreased at the time of photographing, total or partial underexposure occurs, and therefore effective luminance information cannot be acquired. Further, in the measuring object having a portion of locally different reflectance and the measuring object having irregularities like a mirror surface, partial overexposure or underexposure occurs under an influence of lighting.
Thus, a difference between a brightest portion and a darkest portion included in an image of the measuring object formed on the image pickup element is large, and when the dynamic range of the image to be obtained originally exceeds the dynamic range of the image pickup element, there arises a problem that the whole body of the measuring object cannot be properly photographed.
Therefore, a technique of extending the dynamic range is known, in which the dynamic range is extended by photographing the same measuring object more than once under exposure conditions, and compounding a plurality of image data obtained by each photographing. Such a processing is also referred to as a high dynamic composition processing and a super latitude processing (Super Latitude process; SL processing). For example, Japanese Laid-Open Patent Publication No. 2002-334326 discloses a visual sensor realizing extension of the dynamic range with a low calculation processing load.
When an area in the measuring object to be displayed at high accuracy, or an area in the measuring object to be inspected is smaller than the photographing range, it is not necessary to perform composition processing so that the luminance range is optimal for every area of the photographed image data, and it is sufficient to perform composition processing with the luminance range optimized for a necessary area.
Therefore, the present invention is provided to solve the above-described problems, and an object of the present invention is to provide an image processing apparatus capable of generating a composite image with the luminance range optimized for the necessary area.